﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.DB.Architecture;

namespace YJKStairs.CommonUnit
{
	public static class StairsLandingParamManager
	{
		public static double GetLandThickness(ElementId stairsLandingId, Autodesk.Revit.DB.Document rvtDoc)
		{
			double result = 0.0;
			if (null != stairsLandingId && rvtDoc != null)
			{
				result = StairsLandingParamManager.GetLandThickness(rvtDoc.GetElement(stairsLandingId) as StairsLanding);
			}
			return result;
		}

		public static double GetLandThickness(StairsLanding landing)
		{
			double result = 0.0;
			if (landing != null)
			{
				result = landing.Thickness;
			}
			return result;
		}

		public static double GetStairsLandRefHeight(StairsLanding landing)
		{
			double result = 0.0;
			if (landing != null)
			{
				Stairs stairs = landing.GetStairs();
				if (stairs != null)
				{
					result = stairs.BaseElevation;
				}
			}
			return result;
		}

		public static double GetAbsoluteElevation(StairsLanding landing)
		{
			double result = 0.0;
			if (landing != null)
			{
				result = landing.BaseElevation + StairsLandingParamManager.GetStairsLandRefHeight(landing);
			}
			return result;
		}
	}
}
